basepath=$(cd `dirname $0`; pwd)
export PATH=$PATH:/usr/local/go/bin
export GOPATH=/$basepath
export GOBIN=$GOPATH/bin
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
mkdir -p src/github.com/google/
cd src/github.com/google/
git clone https://github.com/lilydjwg/battery-historian.git
git clone https://github.com/gusha915/no-ssr-battery-historian.git
mv no-ssr-battery-historian/base.html battery-historian/templates/
mkdir -p battery-historian/third_party
mv no-ssr-battery-historian/cdn battery-historian/third_party/
cd battery-historian/
go mod init
go mod tidy
go run setup.go
cd third_party/closure-library/
git reset --hard v20170409
cd ../../
go run setup.go
go run cmd/battery-historian/battery-historian.go